home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / ADSPSecure.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  6.1 KB  |  187 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __ADSPSECURE__
  19. #define __ADSPSECURE__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __ADSP__
  25. #include <ADSP.h>
  26. #endif
  27. #ifndef __OCEAUTHDIR__
  28. #include <OCEAuthDir.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /* New ADSP control codes
  54.  
  55.  * open a secure connection */
  56.  
  57. enum {
  58.     sdspOpen                    = 229
  59. };
  60.  
  61. /*
  62. For secure connections, the eom field of ioParams contains two single-bit flags
  63. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  64. eom flag.  All other bits in that field should be zero.
  65.  
  66. To write an encrypted message, you must set an encrypt bit in the eom field of
  67. the ioParams of your write call. Note: this flag is only checked on the first
  68. write of a message (the first write on a connection, or the first write following
  69. a write with eom set.
  70. */
  71.  
  72. enum {
  73.     dspEOMBit                    = 0,                            /* set if EOM at end of write */
  74.     dspEncryptBit                = 1                                /* set to encrypt message */
  75. };
  76.  
  77.  
  78. enum {
  79.     dspEOMMask                    = 1 << dspEOMBit,
  80.     dspEncryptMask                = 1 << dspEncryptBit
  81. };
  82.  
  83.  
  84. /*
  85. Define an ADSPSecure parameter block, as used for the secure Open call.
  86.  
  87.  * size of ADSPSecure workspace */
  88.  
  89. enum {
  90.     sdspWorkSize                = 2048
  91. };
  92.  
  93. struct TRSecureParams {
  94.     unsigned short                     localCID;                    /* local connection id */
  95.     unsigned short                     remoteCID;                    /* remote connection id */
  96.     AddrBlock                         remoteAddress;                /* address of remote end */
  97.     AddrBlock                         filterAddress;                /* address filter */
  98.     unsigned long                     sendSeq;                    /* local send sequence number */
  99.     unsigned short                     sendWindow;                    /* send window size */
  100.     unsigned long                     recvSeq;                    /* receive sequence number */
  101.     unsigned long                     attnSendSeq;                /* attention send sequence number */
  102.     unsigned long                     attnRecvSeq;                /* attention receive sequence number */
  103.     unsigned char                     ocMode;                        /* open connection mode */
  104.     unsigned char                     ocInterval;                    /* open connection request retry interval */
  105.     unsigned char                     ocMaximum;                    /* open connection request retry maximum */
  106.  
  107.     Boolean                         secure;                        /*  --> TRUE if session was authenticated */
  108.     AuthKeyPtr                         sessionKey;                    /* <--> encryption key for session */
  109.     unsigned long                     credentialsSize;            /*  --> length of credentials */
  110.     void *                            credentials;                /*  --> pointer to credentials */
  111.     void *                            workspace;                    /*  --> pointer to workspace for connection align on even boundary and length = sdspWorkSize */
  112.     AuthIdentity                     recipient;                    /*  --> identity of recipient (or initiator if active mode */
  113.     UTCTime                         issueTime;                    /*  --> when credentials were issued */
  114.     UTCTime                         expiry;                        /*  --> when credentials expiry */
  115.     RecordIDPtr                     initiator;                    /* <--  RecordID of initiator returned here. Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  116.     Boolean                         hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  117.     Boolean                         filler1;
  118.     RecordIDPtr                     intermediary;                /* <--  RecordID of intermediary returned here. (If intermediary is found in credentials Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  119. };
  120. typedef struct TRSecureParams TRSecureParams;
  121.  
  122. typedef struct SDSPParamBlock             SDSPParamBlock;
  123. typedef SDSPParamBlock *                SDSPPBPtr;
  124. typedef CALLBACK_API( void , SDSPIOCompletionProcPtr )(SDSPPBPtr paramBlock);
  125. /*
  126.     WARNING: SDSPIOCompletionProcPtr uses register based parameters under classic 68k
  127.              and cannot be written in a high-level language without 
  128.              the help of mixed mode or assembly glue.
  129. */
  130. typedef REGISTER_UPP_TYPE(SDSPIOCompletionProcPtr)                 SDSPIOCompletionUPP;
  131. struct SDSPParamBlock {
  132.     QElem *                            qLink;
  133.     short                             qType;
  134.     short                             ioTrap;
  135.     Ptr                             ioCmdAddr;
  136.     SDSPIOCompletionUPP             ioCompletion;
  137.     OSErr                             ioResult;
  138.     StringPtr                         ioNamePtr;
  139.     short                             ioVRefNum;
  140.     short                             ioCRefNum;                    /* adsp driver refNum */
  141.     short                             csCode;                        /* adsp driver control code */
  142.     long                             qStatus;                    /* adsp internal use */
  143.     short                             ccbRefNum;
  144.     union {
  145.         TRinitParams                     initParams;                /* dspInit, dspCLInit */
  146.         TRopenParams                     openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  147.         TRcloseParams                     closeParams;            /*dspClose, dspRemove*/
  148.         TRioParams                         ioParams;                /*dspRead, dspWrite*/
  149.         TRattnParams                     attnParams;                /*dspAttention*/
  150.         TRstatusParams                     statusParams;            /*dspStatus*/
  151.         TRoptionParams                     optionParams;            /*dspOptions*/
  152.         TRnewcidParams                     newCIDParams;            /*dspNewCID*/
  153.         TRSecureParams                     secureParams;            /* dspOpenSecure */
  154.     }                                 u;
  155. };
  156.  
  157. enum { uppSDSPIOCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  158. #define NewSDSPIOCompletionProc(userRoutine)                     (SDSPIOCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  159. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  160.     #pragma parameter CallSDSPIOCompletionProc(__A1, __A0)
  161.     void CallSDSPIOCompletionProc(SDSPIOCompletionUPP routine, SDSPPBPtr paramBlock) = 0x4E91;
  162. #else
  163.     #define CallSDSPIOCompletionProc(userRoutine, paramBlock)     CALL_ONE_PARAMETER_UPP((userRoutine), uppSDSPIOCompletionProcInfo, (paramBlock))
  164. #endif
  165.  
  166.  
  167. #if PRAGMA_STRUCT_ALIGN
  168.     #pragma options align=reset
  169. #elif PRAGMA_STRUCT_PACKPUSH
  170.     #pragma pack(pop)
  171. #elif PRAGMA_STRUCT_PACK
  172.     #pragma pack()
  173. #endif
  174.  
  175. #ifdef PRAGMA_IMPORT_OFF
  176. #pragma import off
  177. #elif PRAGMA_IMPORT
  178. #pragma import reset
  179. #endif
  180.  
  181. #ifdef __cplusplus
  182. }
  183. #endif
  184.  
  185. #endif /* __ADSPSECURE__ */
  186.  
  187.